<template>
  <div>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="id"
        label="ID">
      </el-table-column>
      <el-table-column
        prop="role_name"
        label="名称">
      </el-table-column>
      <el-table-column
        prop="role_en"
        label="大小">
      </el-table-column>
      <el-table-column
        prop="description"
        label="发布人">
      </el-table-column>
      <el-table-column
        prop="description"
        label="发布时间">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="primary"
            plain
            icon="el-icon-download"
            @click="download(scope.row)">
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="pageSizes"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
</template>
<script>
import {rolePage} from "@/api/role";

export default {
  name: 'index',
  data() {
    return {
      tableData: [],
      multipleSelection: [],
      currentPage: 1,
      pageSizes: [5, 10, 15, 20],
      pageSize: 5,
      total: 0,
    }
  },
  methods: {
    download(row) {

    },
    handleSizeChange(val) {
      this.pageSize = val
      this.rolePageData()
    },
    handleCurrentChange(val) {
      this.currentPage = val
      this.rolePageData()
    },
    //关闭弹窗时 清除表单数据
    clearInfo() {
    },
    rolePageData() {
      rolePage({page: this.currentPage, size: this.pageSize})
        .then((res) => {
          this.tableData = res.tableData
          this.total = res.total
        })
    }
  },
  created() {
    this.rolePageData()
  }
}
</script>
<style scoped lang="scss">

</style>

